using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.EnterpriseTools.OperationDesigner;
using Microsoft.VisualStudio.VirtualTreeGrid;
using Microsoft.VisualStudio.Modeling;

namespace EastBancTech.InstallerDefinition.DslEditors.Controls
{
    public class FileSetColumn : ColumnDescriptor
    {
        private OperationDesignerInPlaceEditCombo comboBox;

        public FileSetColumn()
            : base("FileACtion")
        {
        }

        public override object GetInPlaceEdit(object component, ref string alternateText)
        {
            ModelElement entry = component as ModelElement;
            if (this.comboBox == null)
            {
                this.comboBox = new OperationDesignerInPlaceEditCombo(null, this, component, TypeEditorHostEditControlStyle.ReadOnlyEdit);
                this.comboBox.Flags &= ~VirtualTreeInPlaceControlFlags.DisposeControl;
            }
            else
            {
                this.comboBox.CurrentInstance = component;
            }
            this.comboBox.Items.Clear();
            foreach (FileSet fac in entry.Store.ElementDirectory.FindElements<FileSet>())
            {
                this.comboBox.Items.Add(fac.Name);
            }
            return this.comboBox;

        }

        public override OperationDesignerValueSupportedStates GetValueSupported(object component)
        {
            return OperationDesignerValueSupportedStates.Supported;
        }

        public override object GetValue(object component)
        {
            return component;            
        }

        public override void SetValue(object component, object value)
        {
            
        }
    }
}
